package cn.edu.hunau.oop.day02;

/**
 * 描述平面中的一个圆
 *
 * @author hb
 * @date 2025-08-05 09:20:42
 */
public class Circle {

    int r;//半径
    Point center;//圆心

    public Circle(){

    }

    public Circle(int r,Point center){
        this.r = r;
        this.center = center;
    }

    public Circle(int r,int x,int y){
        this(r,new Point(x,y));
    }

    public double area(){

        return ((int)(Math.PI * r * r*100))/100.0;
    }

    //判断一个点是否在圆的内部
    public boolean container(Point p){
       return   this.center.distance(p)<=r;
    }

    public boolean container(int x,int y){
        return   this.container(new Point(x,y));
    }

}
